<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="https://cdn.bootcss.com/angular.js/1.6.6/angular.min.js"></script>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div ng-app="myApp" ng-controller="siteCtrl">

    名: <input type="text" ng-model="firstName"><br>
    姓: <input type="text" ng-model="lastName"><br>
    <button ng-click="add()">添加</button>

</div>

<script>
    var app = angular.module('myApp', []);

    app.controller('siteCtrl', function($scope, $http) {
       $scope.add=function () {
           $http.post('/people',{
               firstName:$scope.firstName,
               lastName:$scope.lastName
           }).then(function () {
               alert('y');
           },function () {
               alert('n');
           });
       }

    });
</script>


</body>
</html>